package com.llt.chatroom.service;

import com.llt.chatroom.mapper.MessageMapper;
import com.llt.chatroom.model.Message;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MessageService {

    @Resource
    MessageMapper messageMapper;

    public String getLastMessageBySessionId(int sessionId) {

        return messageMapper.getLastMessageBySessionId(sessionId);

    }

    public List<Message> getMessagesBySessionId(int sessionId) {

        return messageMapper.getMessagesBySessionId(sessionId);

    }

    public void add(Message message) {
        messageMapper.add(message);
    }
}
